<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<script type="text/javascript">
    var articleTypeTreeGridSelect;
    $(function() {
        var checkedids="${ids}";
    	articleTypeTreeGridSelect = $('#articleTypeTreeGridSelect').treegrid({
            url : '${path}/articleType/treeGrid',
            idField : 'id',
            treeField : 'name',
            parentField : 'pid',
            fit : true,
            singleSelect:${!flag},
            fitColumns : false,
            border : false,
            columns : [ [ 
                {
                width : '100',
                title : 'id',
                field : 'id',
                hidden:true
            },
                {
                width : '100',
                title : '名称',
                field : 'name'
            },
                {
                width : '100',
                title : '父类ID',
                field : 'pid',
                hidden:true
            },
                {
                width : '100',
                title : '排序',
                field : 'seq'
            }
           ] ],
            onLoadSuccess:function(row,data){
                if(data){
                    console.log(checkedids)
                    if(!isNull(checkedids)){
                        varcheckedidsArr=checkedids.split(',');
                        $.each(data, function(index, item){
                            $.each(varcheckedidsArr,function(i,item1){
                                if(item.id==item1){
                                    articleTypeTreeGridSelect.treegrid('select', item.id);
                                }
                            })
                        });
                    }
                }
            }
        });
    });
  
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false"  style="overflow: hidden;">
        <table id="articleTypeTreeGridSelect"></table>
    </div>
</div>